#Copyright (c) 2025, Alibaba Cloud and its affiliates;
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at

#   http://www.apache.org/licenses/LICENSE-2.0

#Unless required by applicable law or agreed to in writing, software
#distributed under the License is distributed on an "AS IS" BASIS,
#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#See the License for the specific language governing permissions and
#limitations under the License.



import requests
import json
import uuid
import argparse

url = "http://SERVER_HOST_IP:12021/cluster/deleteRayCluster"

def get_request_id():
    return str(uuid.uuid1())

def main():
    parser = argparse.ArgumentParser(description='参数传递')
    parser.add_argument( 
        '--id',
        dest='cluster_id',
        nargs = '?',
        help='Ray Cluster Id',
        required=True,
        )  
    args = parser.parse_args()

    request_id = get_request_id()
    print('Delete ray cluster request id: %s '  % request_id)

    data = {
        "RequestId": request_id,
        "ClusterId": args.cluster_id,
        "KubeConfPath": "/root/.kube/config",
        "Namespace": "default",
    }

    response = requests.post(url, data=data, verify=False)

    if response.status_code == 200:
        received_data = response.json()
        print("Received data:", received_data)
    else:
        print("Request failed with status code:", response.status_code)


if __name__ == '__main__':
    main()